package com.qk.management.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qk.entity.Activity;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ActivityMapper extends BaseMapper<Activity> {
    Integer count(@Param("channel")Integer channel,
                  @Param("type")Integer type,
                  @Param("status")Integer status
                  );

    List<Activity> selectPage(
            @Param("channel") Integer channel,
            @Param("type") Integer type,
            @Param("status") Integer status,
            @Param("offset") Integer offset,
            @Param("pageSize") Integer pageSize
    );
    @Insert("insert into activity(channel,name,start_time,end_time,description,type,discount,voucher,create_time,update_time) " +
            "values(#{channel},#{name},#{startTime},#{endTime},#{description},#{type},#{discount},#{voucher},#{createTime},#{updateTime})")
    int  insert(Activity activity);

    @Select("select * from activity where id = #{id}")
    Activity selectById(Integer id);

    void update(Activity activity);

    @Delete("delete from activity where id = #{id}")
    void deleteById(Integer id);
    @Select("select * from activity")
    List<Activity> selectAll();
    @Select("select * from activity where type = #{type}")
    List<Activity> selectByType(String type);
}
